/*
 * MySQL Cluster SNMP monitoring subagent
 * Copyright (C) 2011, Steven Ayre <steveayre@gmail.com>
 *
 * Version: MPL 1.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is MySQL Cluster SNMP monitoring subagent
 *
 * The Initial Developer of the Original Code is
 * Steven Ayre <steveayre@gmail.com>
 * Portions created by the Initial Developer are Copyright (C)
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Steven Ayre <steveayre@gmail.com>
 *
 * ndb_mgm.h -- NDB MGM thread header
 *
 */

#ifndef __NDB_MGM_H__
#define __NDB_MGM_H__

#include <stdint.h>
#include <pthread.h>
#include </usr/include/netinet/in.h>
#include "thread.h"

int ndb_mgm_main(thread_t *thread, void *param);

typedef union{
    in_addr_t v4;
    struct in6_addr v6;
} ip_t;

typedef struct {
	uint32_t cluster_idx;
	uint32_t idx;
	uint32_t id;
	int      connected;
	ip_t     ip_addr;
	uint8_t  addr_family;
	char     version[50];
	uint32_t nodegroup;
} ndb_node_entry_t;

typedef struct {
	int              num_nodes;
	int              size;
	ndb_node_entry_t *nodes;
} ndb_node_table_t;

typedef struct {
	pthread_mutex_t mutex;
	ndb_node_table_t mgmt;
	ndb_node_table_t data;
	ndb_node_table_t api;
} ndb_node_tables_t;

#endif

